package com.lanou.dllo.mynovel.dataBase;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

/**
 * Created by dllo on 15/10/30.
 */
public class MySQLiteOpenHelper extends SQLiteOpenHelper {


    public MySQLiteOpenHelper(Context context, String name, SQLiteDatabase.CursorFactory factory, int version) {
        super(context, name, factory, version);
    }

    //"creat table 表名(属性（列名） 数据类型, xxx kind)"
    @Override
    public void onCreate(SQLiteDatabase db) {
        String sql = " create table " + Constant.TABLE_NAME_UPDATE
                + " ( " + Constant.COLUMN_STOREUPDATE_RECYCLERVIEW_COVER + " varchar(255),"
                + Constant.COLUMN_STOREUPDATE_RECYCLERVIEW_NAME + " varchar(255),"
                + Constant.COLUMN_STOREUPDATE_RECYCLERVIEW_NICKNAME + " varchar(255),"
                + Constant.COLUMN_STOREUPDATE_RECYCLERVIEW_CLASSIFYNAME + " varchar(255),"
                + Constant.COLUMN_STOREUPDATE_RECYCLERVIEW_CLICK_TOTAL + " varchar(255),"
                + Constant.COLUMN_STOREUPDATE_RECYCLERVIEW_LIST_UPDATE_TIME + " varchar(255),"
                + Constant.COLUMN_STOREUPDATE_RECYCLERVIEW_LIST_UPDATE_CHAPTER_NAME + " varchar(255),"
                + "_msgId integer primary key autoincrement " + " ) ";
        db.execSQL(sql);

        String sql1 = " create table " + Constant.TABLE_NAME_RANKING
                + " ( " + Constant.COLUMN_STORERANKING_RECYCLERVIEW_COVER + " varchar(255), "
                + Constant.COLUMN_STORERANKING_RECYCLERVIEW_RANKINGNAME + " varchar(255), "
                + Constant.COLUMN_STORERANKING_RECYCLERVIEW_RANKINGDESCRIPTION1 + " varchar(255), "
                + Constant.COLUMN_STORERANKING_RECYCLERVIEW_RANKINGDESCRIPTION2 + " varchar(255), "
                + " _msgId integer primary key autoincrement " + " ) ";
        db.execSQL(sql1);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

    }
}
